//
//  BaseViewController.swift
//  WeiBoText
//
//  Created by 刘世瑛 on 16/1/10.
//  Copyright © 2016年 刘世瑛. All rights reserved.
//

import UIKit
import SVProgressHUD
class BaseViewController: UITableViewController ,BaseViewDelegate {

    var isLogIn = false
    
    var vistorLoginView :BaseView?;
    
    
    func didLoginClick() {
     
        let oAuth = OAuthViewController()
        let nav = UINavigationController(rootViewController: oAuth)
        presentViewController(nav, animated: true, completion: nil)
    }
    
    
    
    
    func didRegistClick() {
        
    }
    
    
  @objc private func  userWillLogin()
    {
        let oAuth = OAuthViewController()
        
        presentViewController(oAuth, animated: true, completion: nil)
        
    }
    
    
    
    
    
    
    
    
    override func loadView() {
        
        if isLogIn{
            
            view = UITableView()
         
            
        }else{
            vistorLoginView = BaseView()
            
              view = vistorLoginView
            vistorLoginView?.baseDelegate = self
            
            
            
            //添加左右侧按钮
            
            self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "didLoginClick")
            
               self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "didRegistClick")
        }
        
        
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        
        
        

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
